package com.fy.tt.entity;


import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.sql.ResultSet;
import java.util.Date;

@Data
@NoArgsConstructor
@Table(name = "bls_word")
public class Word {
    @Id
    @Column(name = "id")
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "creator_id")
    private Long creatorId;

    @Column(name = "update_time")
    private Date updateTime;

    // 词汇类型 1：名词 2：动词 。。。
    @Column(name = "is_type_in")
    private Long isTypeIn;

    // 词汇使用范围，目前代表分享状态 0：原生公共词汇（帮语平台） 1：其他帮区私有词汇  2：其他帮区拉取的公共词汇
    @Column(name = "is_range")

    private Long isRange;

    // 涉及审核发布后的状态表示（暂不考虑）
    @Column(name = "status")
    private Long status;

    @Column(name = "band_obj_id")
    private Long bandObjId;

    // 词汇用例说明描述
    @Column(name = "description")
    private String description;

    public Word(ResultSet rs) {
        try {
            this.id = rs.getLong("id");
            this.name = rs.getString("name");
            this.creatorId = rs.getLong("creator_id") ;
            this.updateTime = rs.getTimestamp("update_time") ;
            this.isTypeIn = rs.getLong("is_type_in");
            this.isRange = rs.getLong("is_range");
            this.status = rs.getLong("status");
            this.bandObjId = rs.getLong("band_obj_id");
            this.description = rs.getString("description");
        }catch (Exception e){
            System.out.println(e.getCause());
        }
    }
}
